//
//  YH_Lrc.m
//  UI27_音乐播放器
//
//  Created by dllo on 16/8/20.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "YH_Lrc.h"

@implementation YH_Lrc

- (instancetype)init {
    self = [super init];
    if (self) {
        self.lrcArray = [NSMutableArray array];
        self.timeArray = [NSMutableArray array];
    }
    return self;
}

- (void)lrcWithFileURL:(NSString *)lrcPath {
    [self.lrcArray removeAllObjects];
    [self.timeArray removeAllObjects];
    NSString *lrcStr = [NSString stringWithContentsOfFile:lrcPath encoding:NSUTF8StringEncoding error:nil];
    // 将歌词字符串以"["分割成一个个小的字符串 放在数组做中
    NSArray *lrcArray = [lrcStr componentsSeparatedByString:@"["];
    for (NSString *str in lrcArray) {
        NSArray *array = [str componentsSeparatedByString:@"]"];
        if (!([array[0] isEqualToString:@""] || [array[1] isEqualToString:@"\n"] || [array[1] isEqualToString:@"\r\n"])) {
                [self.timeArray addObject:array[0]];
                [self.lrcArray addObject:array[1]];
            
        }
    }
}








@end
